const install = Vue => {
	Vue.prototype.$scanPopup = {
		openScan(param) { // 触发扫码
			let that = this;
			// 判断当前触发设备类型
			switch (Vue.prototype.$store.state.systemConfig.sysDeviceInfo.scanDeviceType) {
				case 'GKJ': // 工控机
					uni.navigateTo({
						url: "/commonPage/Tool/pageScanByGKJ",
						events: {
							success: function(res) {
								param.success && param.success(res)
								uni.hideKeyboard()
							}
						}
					})
					break;
				default:
					// 普通扫码
					Vue.prototype.$store.commit('ChangeAndSetStateData', {
						Name1: 'systemConfig.msgConfig.msgBtnIsHide',
						data: true,
					});
					uni.scanCode({
						onlyFromCamera: param.onlyFromCamera || true,
						scanType: param.scanType || ['qrCode'],
						success: function(res) {
							param.success && param.success(res)
							uni.hideKeyboard()
						},
						complete: () => {
							Vue.prototype.$store.commit('ChangeAndSetStateData', {
								Name1: 'systemConfig.msgConfig.msgBtnIsHide',
								data: false,
							});
						}
					});
					break;
			}

		}
	}
}
export default install;